{
  "name": "Case 56: Ad Spend ROI Synthesizer",
  "nodes": [
    {
      "parameters": {
        "path": "campaign-report",
        "formTitle": "Campaign Report Upload",
        "formDescription": "Upload campaign performance report",
        "formFields": {
          "values": [
            {
              "fieldLabel": "Upload Report (PDF/Image)",
              "fieldType": "file",
              "requiredField": true
            }
          ]
        },
        "options": {}
      },
      "id": "2a2c75e8-515f-46d0-9b07-5a26d2b8376d",
      "name": "Campaign Report Form",
      "type": "n8n-nodes-base.formTrigger",
      "typeVersion": 2.1,
      "position": [
        -992,
        0
      ],
      "webhookId": "campaign-report"
    },
    {
      "parameters": {
        "method": "POST",
        "url": "https://api.cloud.llamaindex.ai/api/v1/parsing/upload",
        "sendHeaders": true,
        "headerParameters": {
          "parameters": [
            {
              "name": "Authorization",
              "value": "Bearer llx-7BWYrvPwfUhgdXbZMtaNCsr2O0h7JH4dkHjHisxcvq46bkIj"
            }
          ]
        },
        "sendBody": true,
        "contentType": "multipart-form-data",
        "bodyParameters": {
          "parameters": [
            {
              "parameterType": "formBinaryData",
              "name": "file",
              "inputDataFieldName": "Upload_Report__PDF_Image_"
            }
          ]
        },
        "options": {}
      },
      "id": "2569adab-9ae4-4e8d-a3e8-cb315e4c8f2a",
      "name": "Upload Report",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.3,
      "position": [
        -816,
        0
      ]
    },
    {
      "parameters": {
        "amount": 20
      },
      "id": "7bf23ea4-6888-49b4-8ec4-bd97a657b809",
      "name": "Wait",
      "type": "n8n-nodes-base.wait",
      "typeVersion": 1.1,
      "position": [
        -608,
        0
      ],
      "webhookId": "99a5016f-b883-4423-a7f3-f9d97f6916bc"
    },
    {
      "parameters": {
        "url": "=https://api.cloud.llamaindex.ai/api/v1/parsing/job/{{ $node[\"Upload Report\"].json[\"id\"] }}",
        "sendHeaders": true,
        "headerParameters": {
          "parameters": [
            {
              "name": "Authorization",
              "value": "Bearer llx-7BWYrvPwfUhgdXbZMtaNCsr2O0h7JH4dkHjHisxcvq46bkIj"
            }
          ]
        },
        "options": {}
      },
      "id": "826f8c42-473d-4226-97bb-c34af28b0c4a",
      "name": "Check Status",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.3,
      "position": [
        -448,
        0
      ]
    },
    {
      "parameters": {
        "rules": {
          "values": [
            {
              "conditions": {
                "options": {
                  "caseSensitive": true,
                  "leftValue": "",
                  "typeValidation": "strict",
                  "version": 2
                },
                "conditions": [
                  {
                    "leftValue": "={{ $json.status }}",
                    "rightValue": "SUCCESS",
                    "operator": {
                      "type": "string",
                      "operation": "equals"
                    },
                    "id": "3cc58cb9-9032-4ae4-ae03-bcf00f6d9179"
                  }
                ],
                "combinator": "and"
              },
              "renameOutput": true,
              "outputKey": "SUCCESS"
            },
            {
              "conditions": {
                "options": {
                  "caseSensitive": true,
                  "leftValue": "",
                  "typeValidation": "strict",
                  "version": 2
                },
                "conditions": [
                  {
                    "leftValue": "={{ $json.status }}",
                    "rightValue": "PENDING",
                    "operator": {
                      "type": "string",
                      "operation": "equals"
                    },
                    "id": "14f958b2-bbcf-4dc5-9fd9-51645b3991c0"
                  }
                ],
                "combinator": "and"
              },
              "renameOutput": true,
              "outputKey": "PENDING"
            }
          ]
        },
        "options": {}
      },
      "id": "378bb447-2101-4ee1-b923-cca369db3f5f",
      "name": "Router",
      "type": "n8n-nodes-base.switch",
      "typeVersion": 3.3,
      "position": [
        -256,
        0
      ]
    },
    {
      "parameters": {
        "url": "=https://api.cloud.llamaindex.ai/api/v1/parsing/job/{{ $node[\"Upload Report\"].json[\"id\"] }}/result/markdown",
        "sendHeaders": true,
        "headerParameters": {
          "parameters": [
            {
              "name": "Authorization",
              "value": "Bearer llx-7BWYrvPwfUhgdXbZMtaNCsr2O0h7JH4dkHjHisxcvq46bkIj"
            }
          ]
        },
        "options": {}
      },
      "id": "c5d8c06d-a413-4503-be5c-b13f947f75cc",
      "name": "Get Data",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.3,
      "position": [
        -112,
        -112
      ]
    },
    {
      "parameters": {
        "text": "={{ $json.markdown }}",
        "attributes": {
          "attributes": [
            {
              "name": "Campaign_Name",
              "description": "Campaign name"
            },
            {
              "name": "Platform",
              "description": "Google Ads/Facebook/LinkedIn/Instagram"
            },
            {
              "name": "Manager_Email",
              "description": "Email"
            },
            {
              "name": "Total_Spend",
              "description": "Spend (numeric)"
            },
            {
              "name": "Total_Revenue",
              "description": "Revenue (numeric)"
            },
            {
              "name": "Total_Conversions",
              "description": "Conversions (integer)"
            },
            {
              "name": "Conversion_Rate_Percentage",
              "description": "Rate (number)"
            },
            {
              "name": "Cost_Per_Click",
              "description": "CPC (numeric)"
            }
          ]
        },
        "options": {}
      },
      "id": "e4739b32-d3ce-470b-b240-dd844f814239",
      "name": "Extract Data",
      "type": "@n8n/n8n-nodes-langchain.informationExtractor",
      "typeVersion": 1.2,
      "position": [
        48,
        -112
      ]
    },
    {
      "parameters": {
        "jsCode": "const e=$node[\"Extract Data\"].json.output||{};const BENCHMARKS={'Google Ads':{targetROI:300,avgCPC:3.50,avgConversionRate:3.5},'Facebook':{targetROI:250,avgCPC:1.80,avgConversionRate:2.8},'LinkedIn':{targetROI:200,avgCPC:5.50,avgConversionRate:2.2},'Instagram':{targetROI:220,avgCPC:2.00,avgConversionRate:2.5},'Default':{targetROI:250,avgCPC:3.00,avgConversionRate:3.0}};const p=e.Platform||'Default';const s=parseFloat(e.Total_Spend||0);const r=parseFloat(e.Total_Revenue||0);const cv=parseFloat(e.Conversion_Rate_Percentage||0);const cpc=parseFloat(e.Cost_Per_Click||0);const b=BENCHMARKS[p]||BENCHMARKS.Default;let roi=0;if(s>0)roi=((r-s)/s*100).toFixed(2);let sc=0;const ra=(parseFloat(roi)/b.targetROI)*100;if(ra>=100)sc+=40;else if(ra>=80)sc+=32;else if(ra>=60)sc+=24;else sc+=16;if(cpc>0&&cpc<=b.avgCPC)sc+=30;else if(cpc<=b.avgCPC*1.2)sc+=20;else sc+=10;if(cv>=b.avgConversionRate)sc+=20;else if(cv>=b.avgConversionRate*0.8)sc+=15;else sc+=10;sc=Math.min(sc,100);let rating='';let decision='';let rec='';if(sc>=80){rating='EXCELLENT';decision='SCALE_UP';rec=`Increase budget 30-50%. ROI: ${roi}%`;}else if(sc>=60){rating='GOOD';decision='CONTINUE';rec='Maintain budget. Monitor performance.';}else if(sc>=40){rating='POOR';decision='OPTIMIZE';rec=`Reduce budget 20-30%. ROI: ${roi}% (Target: ${b.targetROI}%)`;}else{rating='FAILING';decision='PAUSE_REVIEW';rec=`Pause immediately. ROI: ${roi}% below threshold.`;}return{Campaign_Name:e.Campaign_Name||'NOT_FOUND',Platform:p,Total_Spend:`₹${s.toFixed(2)}`,Total_Revenue:`₹${r.toFixed(2)}`,ROI_Percentage:`${roi}%`,Conversion_Rate:`${cv}%`,Cost_Per_Conversion:`₹${(s/(parseInt(e.Total_Conversions||1))).toFixed(2)}`,Performance_Score:sc,Performance_Rating:rating,Budget_Recommendation:rec,Optimization_Priority:sc>=80?'LOW':sc>=60?'MEDIUM':'HIGH',Decision:decision,Alert_Sent_To:sc>=80?'Manager':sc>=60?'Manager':'Manager+CMO',Next_Review_Date:new Date(Date.now()+(sc>=80?30:sc>=60?14:7)*86400000).toISOString().split('T')[0],Status:decision==='SCALE_UP'?'ACTIVE-HIGH':decision==='CONTINUE'?'ACTIVE-GOOD':decision==='OPTIMIZE'?'ACTIVE-OPTIMIZE':'PAUSED',_manager_email:e.Manager_Email||'marketing@company.com',_score:sc};"
      },
      "id": "8773d71d-d74b-447a-88af-797b728b5697",
      "name": "ROI Engine",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        368,
        -112
      ]
    },
    {
      "parameters": {
        "operation": "append",
        "documentId": {
          "__rl": true,
          "value": "1xAZjwv2-aLYHNkrzhcUVr_iXoE8BNFptyNzFeRGtntA",
          "mode": "list",
          "cachedResultName": "Case 56 - Ad Spend Performance Log",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1xAZjwv2-aLYHNkrzhcUVr_iXoE8BNFptyNzFeRGtntA/edit?usp=drivesdk"
        },
        "sheetName": {
          "__rl": true,
          "value": "gid=0",
          "mode": "list",
          "cachedResultName": "Sheet1",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1xAZjwv2-aLYHNkrzhcUVr_iXoE8BNFptyNzFeRGtntA/edit#gid=0"
        },
        "columns": {
          "mappingMode": "defineBelow",
          "value": {
            "Campaign_Name": "={{ $json.Campaign_Name }}",
            "Platform": "={{ $json.Platform }}",
            "Total_Spend": "={{ $json.Total_Spend }}",
            "Total_Revenue": "={{ $json.Total_Revenue }}",
            "ROI_Percentage": "={{ $json.ROI_Percentage }}",
            "Conversion_Rate": "={{ $json.Conversion_Rate }}",
            "Cost_Per_Conversion": "={{ $json.Cost_Per_Conversion }}",
            "Performance_Score": "={{ $json.Performance_Score }}",
            "Performance_Rating": "={{ $json.Performance_Rating }}",
            "Budget_Recommendation": "={{ $json.Budget_Recommendation }}",
            "Optimization_Priority": "={{ $json.Optimization_Priority }}",
            "Decision": "={{ $json.Decision }}",
            "Alert_Sent_To": "={{ $json.Alert_Sent_To }}",
            "Next_Review_Date": "={{ $json.Next_Review_Date }}",
            "Status": "={{ $json.Status }}"
          },
          "matchingColumns": [],
          "schema": [
            {
              "id": "Campaign_Name",
              "displayName": "Campaign_Name",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "Platform",
              "displayName": "Platform",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "Total_Spend",
              "displayName": "Total_Spend",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "Total_Revenue",
              "displayName": "Total_Revenue",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "ROI_Percentage",
              "displayName": "ROI_Percentage",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "Conversion_Rate",
              "displayName": "Conversion_Rate",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "Cost_Per_Conversion",
              "displayName": "Cost_Per_Conversion",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "Performance_Score",
              "displayName": "Performance_Score",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "Performance_Rating",
              "displayName": "Performance_Rating",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "Budget_Recommendation",
              "displayName": "Budget_Recommendation",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "Optimization_Priority",
              "displayName": "Optimization_Priority",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "Decision",
              "displayName": "Decision",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "Alert_Sent_To",
              "displayName": "Alert_Sent_To",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "Next_Review_Date",
              "displayName": "Next_Review_Date",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "Status",
              "displayName": "Status",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            }
          ],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {}
      },
      "id": "51380275-dc57-437b-9b6b-8cc426da226c",
      "name": "Log to Sheet",
      "type": "n8n-nodes-base.googleSheets",
      "typeVersion": 4.7,
      "position": [
        544,
        -112
      ],
      "credentials": {
        "googleSheetsOAuth2Api": {
          "id": "LOs2dbk9lby0NfDM",
          "name": "Google Sheets account"
        }
      }
    },
    {
      "parameters": {
        "rules": {
          "values": [
            {
              "conditions": {
                "options": {
                  "caseSensitive": true,
                  "leftValue": "",
                  "typeValidation": "strict",
                  "version": 2
                },
                "conditions": [
                  {
                    "leftValue": "={{ $json.Decision }}",
                    "rightValue": "SCALE_UP",
                    "operator": {
                      "type": "string",
                      "operation": "equals"
                    },
                    "id": "141ff863-63a7-4ee7-84de-84a40e6f9ed9"
                  }
                ],
                "combinator": "and"
              },
              "renameOutput": true,
              "outputKey": "SUCCESS"
            },
            {
              "conditions": {
                "options": {
                  "caseSensitive": true,
                  "leftValue": "",
                  "typeValidation": "strict",
                  "version": 2
                },
                "conditions": [
                  {
                    "leftValue": "={{ $json.Decision }}",
                    "rightValue": "PAUSE_REVIEW",
                    "operator": {
                      "type": "string",
                      "operation": "equals"
                    },
                    "id": "495526ed-01c1-4bf3-bb6a-f52b5e05a393"
                  }
                ],
                "combinator": "and"
              },
              "renameOutput": true,
              "outputKey": "URGENT"
            },
            {
              "conditions": {
                "options": {
                  "caseSensitive": true,
                  "leftValue": "",
                  "typeValidation": "strict",
                  "version": 2
                },
                "conditions": [
                  {
                    "id": "e23d52a2-8851-4b96-977c-8b7e4fd3fd0e",
                    "leftValue": "={{ $json.Decision }}",
                    "rightValue": "CONTINUE",
                    "operator": {
                      "type": "string",
                      "operation": "equals",
                      "name": "filter.operator.equals"
                    }
                  }
                ],
                "combinator": "and"
              }
            },
            {
              "conditions": {
                "options": {
                  "caseSensitive": true,
                  "leftValue": "",
                  "typeValidation": "strict",
                  "version": 2
                },
                "conditions": [
                  {
                    "id": "ad0d2fc3-ebcc-4437-8a4d-33cdd8d7f451",
                    "leftValue": "={{ $json.Decision }}",
                    "rightValue": "OPTIMIZE",
                    "operator": {
                      "type": "string",
                      "operation": "equals",
                      "name": "filter.operator.equals"
                    }
                  }
                ],
                "combinator": "and"
              }
            }
          ]
        },
        "options": {
          "fallbackOutput": "none"
        }
      },
      "id": "50b5063b-f85b-489d-9fae-c173ba23f6e2",
      "name": "Email Router",
      "type": "n8n-nodes-base.switch",
      "typeVersion": 3.3,
      "position": [
        720,
        -112
      ]
    },
    {
      "parameters": {
        "jsCode": "const d=$input.first().json||{};return{emailSubject:`✅ Excellent: ${d.Campaign_Name||'Campaign'}|ROI:${d.ROI_Percentage||'N/A'}`,emailBody:`<html><body style=\"font-family:Arial;max-width:700px;margin:0 auto;padding:20px\"><div style=\"background:#10b981;color:white;padding:25px;border-radius:8px\"><h1 style=\"margin:0\">✅ Excellent Performance</h1><p>${d.Campaign_Name||'N/A'}</p></div><div style=\"background:#f9fafb;padding:20px;margin:20px 0;border-radius:8px\"><table style=\"width:100%\"><tr><td style=\"padding:8px 0;color:#666\">Platform:</td><td style=\"font-weight:600\">${d.Platform||'N/A'}</td></tr><tr><td style=\"padding:8px 0;color:#666\">Spend:</td><td>${d.Total_Spend||'N/A'}</td></tr><tr><td style=\"padding:8px 0;color:#666\">Revenue:</td><td style=\"font-weight:700\">${d.Total_Revenue||'N/A'}</td></tr><tr><td style=\"padding:8px 0;color:#666\">ROI:</td><td style=\"font-size:20px;color:#10b981;font-weight:700\">${d.ROI_Percentage||'N/A'}</td></tr><tr><td style=\"padding:8px 0;color:#666\">Score:</td><td style=\"color:#10b981\">${d.Performance_Score||0}/100</td></tr></table></div><div style=\"background:#eff6ff;border:2px solid #3b82f6;padding:20px;border-radius:8px\"><h3 style=\"color:#1e40af;margin:0 0 10px 0\">Recommendation</h3><p style=\"margin:0\">${d.Budget_Recommendation||'Scale up'}</p></div></body></html>`,recipientEmail:d._manager_email||'marketing@company.com'};"
      },
      "id": "29d2132a-630b-45cf-af7a-9e7cf81c1dcc",
      "name": "Build Success Email",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        928,
        -288
      ]
    },
    {
      "parameters": {
        "jsCode": "const d=$input.first().json||{};return{emailSubject:`🚨 URGENT: ${d.Campaign_Name||'Campaign'} Underperforming`,emailBody:`<html><body style=\"font-family:Arial;max-width:700px;margin:0 auto;padding:20px\"><div style=\"background:#dc2626;color:white;padding:25px;border-radius:8px\"><h1 style=\"margin:0\">🚨 Review Required</h1><p>${d.Campaign_Name||'N/A'}</p></div><div style=\"background:#f9fafb;padding:20px;margin:20px 0;border-radius:8px\"><table style=\"width:100%\"><tr><td style=\"padding:8px 0;color:#666\">Platform:</td><td style=\"font-weight:600\">${d.Platform||'N/A'}</td></tr><tr><td style=\"padding:8px 0;color:#666\">Spend:</td><td>${d.Total_Spend||'N/A'}</td></tr><tr><td style=\"padding:8px 0;color:#666\">Revenue:</td><td>${d.Total_Revenue||'N/A'}</td></tr><tr><td style=\"padding:8px 0;color:#666\">ROI:</td><td style=\"color:#dc2626;font-weight:700\">${d.ROI_Percentage||'N/A'}</td></tr><tr><td style=\"padding:8px 0;color:#666\">Rating:</td><td style=\"color:#dc2626;font-weight:700\">${d.Performance_Rating||'POOR'}</td></tr></table></div><div style=\"background:#eff6ff;border:2px solid #3b82f6;padding:20px;border-radius:8px\"><h3 style=\"color:#1e40af;margin:0 0 10px 0\">Action Required</h3><p style=\"margin:0\">${d.Budget_Recommendation||'Review needed'}</p></div></body></html>`,recipientEmail:d._manager_email||'marketing@company.com',cmoEmail:'cmo@company.com'};"
      },
      "id": "97fdd543-85bf-41c4-9350-cf635b8b2282",
      "name": "Build Urgent Email",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        928,
        128
      ]
    },
    {
      "parameters": {
        "jsCode": "const d=$input.first().json||{};return{emailSubject:`📊 Report: ${d.Campaign_Name||'Campaign'}`,emailBody:`<html><body style=\"font-family:Arial;max-width:700px;margin:0 auto;padding:20px\"><div style=\"background:#3b82f6;color:white;padding:25px;border-radius:8px\"><h1 style=\"margin:0\">📊 Performance Report</h1><p>${d.Campaign_Name||'N/A'}</p></div><div style=\"background:#f9fafb;padding:20px;margin:20px 0;border-radius:8px\"><table style=\"width:100%\"><tr><td style=\"padding:8px 0;color:#666\">Platform:</td><td style=\"font-weight:600\">${d.Platform||'N/A'}</td></tr><tr><td style=\"padding:8px 0;color:#666\">Spend:</td><td>${d.Total_Spend||'N/A'}</td></tr><tr><td style=\"padding:8px 0;color:#666\">Revenue:</td><td style=\"font-weight:700\">${d.Total_Revenue||'N/A'}</td></tr><tr><td style=\"padding:8px 0;color:#666\">ROI:</td><td style=\"font-weight:700\">${d.ROI_Percentage||'N/A'}</td></tr><tr><td style=\"padding:8px 0;color:#666\">Rating:</td><td style=\"font-weight:600\">${d.Performance_Rating||'N/A'}</td></tr></table></div><div style=\"background:#f0fdf4;border:2px solid #059669;padding:20px;border-radius:8px\"><h3 style=\"color:#047857;margin:0 0 10px 0\">Recommendation</h3><p style=\"margin:0\">${d.Budget_Recommendation||'Continue'}</p></div></body></html>`,recipientEmail:d._manager_email||'marketing@company.com'};"
      },
      "id": "0734e06f-6b70-43d1-b17c-748c7d06fe1e",
      "name": "Build Standard Email",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        928,
        -80
      ]
    },
    {
      "parameters": {
        "sendTo": "={{ $json.recipientEmail }}",
        "subject": "={{ $json.emailSubject }}",
        "message": "={{ $json.emailBody }}",
        "options": {}
      },
      "id": "a777df55-e092-45fb-ade1-fd1bf672e014",
      "name": "Send Success",
      "type": "n8n-nodes-base.gmail",
      "typeVersion": 2.1,
      "position": [
        1136,
        -288
      ],
      "webhookId": "e0744d16-cb77-4fe3-9a62-9204d442a078",
      "credentials": {
        "gmailOAuth2": {
          "id": "cyqCGWcggZNMcSOv",
          "name": "Gmail account"
        }
      }
    },
    {
      "parameters": {
        "sendTo": "={{ $json.recipientEmail }}",
        "subject": "={{ $json.emailSubject }}",
        "message": "={{ $json.emailBody }}",
        "options": {
          "ccList": "={{ $json.cmoEmail }}"
        }
      },
      "id": "77438e21-d2e0-4a09-a9d2-9afcd9a18552",
      "name": "Send Urgent",
      "type": "n8n-nodes-base.gmail",
      "typeVersion": 2.1,
      "position": [
        1136,
        128
      ],
      "webhookId": "5f2b3f63-4355-48ae-8cc8-14e2afdb0e91",
      "credentials": {
        "gmailOAuth2": {
          "id": "cyqCGWcggZNMcSOv",
          "name": "Gmail account"
        }
      }
    },
    {
      "parameters": {
        "sendTo": "={{ $json.recipientEmail }}",
        "subject": "={{ $json.emailSubject }}",
        "message": "={{ $json.emailBody }}",
        "options": {}
      },
      "id": "3a4a8b8b-4867-4b7d-b4f7-754ca3121cb4",
      "name": "Send Standard",
      "type": "n8n-nodes-base.gmail",
      "typeVersion": 2.1,
      "position": [
        1136,
        -80
      ],
      "webhookId": "49f58bdb-c17f-4d20-9c28-83506424cb36",
      "credentials": {
        "gmailOAuth2": {
          "id": "cyqCGWcggZNMcSOv",
          "name": "Gmail account"
        }
      }
    },
    {
      "parameters": {
        "model": {
          "__rl": true,
          "value": "gpt-4o-mini",
          "mode": "list"
        },
        "builtInTools": {},
        "options": {}
      },
      "id": "53912544-df9d-4c06-8187-aab27dd2fed6",
      "name": "GPT-4o Mini",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "typeVersion": 1.3,
      "position": [
        48,
        96
      ],
      "credentials": {
        "openAiApi": {
          "id": "ICwxUBbatsF2sDvy",
          "name": "OpenAi account"
        }
      }
    }
  ],
  "pinData": {},
  "connections": {
    "Campaign Report Form": {
      "main": [
        [
          {
            "node": "Upload Report",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Upload Report": {
      "main": [
        [
          {
            "node": "Wait",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Wait": {
      "main": [
        [
          {
            "node": "Check Status",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Check Status": {
      "main": [
        [
          {
            "node": "Router",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Router": {
      "main": [
        [
          {
            "node": "Get Data",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Wait",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Data": {
      "main": [
        [
          {
            "node": "Extract Data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Extract Data": {
      "main": [
        [
          {
            "node": "ROI Engine",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "ROI Engine": {
      "main": [
        [
          {
            "node": "Log to Sheet",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Log to Sheet": {
      "main": [
        [
          {
            "node": "Email Router",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Email Router": {
      "main": [
        [
          {
            "node": "Build Success Email",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Build Urgent Email",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Build Standard Email",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Build Standard Email",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Build Success Email": {
      "main": [
        [
          {
            "node": "Send Success",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Build Urgent Email": {
      "main": [
        [
          {
            "node": "Send Urgent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Build Standard Email": {
      "main": [
        [
          {
            "node": "Send Standard",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "GPT-4o Mini": {
      "ai_languageModel": [
        [
          {
            "node": "Extract Data",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    }
  },
  "active": false,
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "6833916a-68b5-4119-aee4-9c790aeebdfd",
  "meta": {
    "templateCredsSetupCompleted": true,
    "instanceId": "3a43da28588548e21903e71cf1dc3ddd65c24bf0c62e7e4b77542ffe87ad79c6"
  },
  "id": "Sdf1qmfga6aySXzX",
  "tags": []
}